home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW noweb 2.7 / src / xdoc / notangle.1 < prev    next >
Encoding:
Text File  |  1995-05-30  |  13.7 KB  |  538 lines  |  [TEXT/MPS ]

  1. .TH NOWEB 1 "local 4/19/93"
  2. .SH NAME
  3. notangle, noweave, nountangle \- noweb, a literate-programming tool
  4. .SH SYNOPSIS
  5. .B notangle
  6. [\fB-R\fProotname] [\fB-filter\fP command]
  7. [\fB-L\fP[format]] [file] ...
  8. .br
  9. \fBnountangle\fP 
  10. [\fB-ml\fP|\fB-m3\fP|\fB-c\fP|\fB-c++\fP|\fB-awk\fP|\fB-tex\fP|\fB-f77\fP|\fB-f90\fP]
  11. [\fB-R\fProotname] [\fB-filter\fP command] [\fB-w\fPwidth] [file] ...
  12. .br
  13. \fBnoweave\fP [options] [file] ...
  14. .SH DESCRIPTION
  15. .I Noweb
  16. is a literate-programming tool like Knuth's
  17. .I WEB,
  18. only simpler.
  19. .I noweb
  20. file contains program source code interleaved with documentation.
  21. When 
  22. .I notangle
  23. is given a 
  24. .I noweb
  25. file, it writes the program on standard output.
  26. When 
  27. .I noweave
  28. is given a 
  29. .I noweb
  30. file, it reads the 
  31. .I noweb
  32. source and produces, on standard output, \fILaTeX\fP, \fITeX\fP, or \fIHTML\fP
  33. source for typeset documentation.
  34. .I nountangle
  35. converts a literate program into an ordinary program by
  36. turning interleaved documentation into comments.
  37. The file name `-' refers to standard input.
  38. .SH FORMAT OF NOWEB FILES
  39. .I noweb 
  40. file is a sequence of
  41. .I chunks,
  42. which may appear in any order.
  43. A chunk may contain code or documentation.
  44. Documentation chunks begin with a line that starts with an at sign (@) 
  45. followed by a space or newline.
  46. They have no names.
  47. Code chunks begin with
  48. .br
  49. <<\fIchunk name\fP>>=
  50. .br
  51. on a line by itself.
  52. The double left angle bracket (<<) must be in the first column.
  53. Chunks are terminated by the beginning of another chunk, or by end of file.
  54. If the first line in the file does not mark the beginning of a
  55. chunk, it is assumed to be the first line of a documentation chunk.
  56. .PP
  57. Documentation chunks contain text that is ignored by
  58. .I notangle
  59. and copied verbatim to 
  60. standard output
  61. by
  62. .I noweave
  63. (except for quoted code).
  64. .I noweave
  65. can work with \fILaTeX\fP, plain \fITeX\fP, or \fIHTML\fP.
  66. With plain \fITeX\fP, it inserts a reference to a 
  67. .I TeX
  68. macro package, \fInwmac\fP, which defines commands like
  69. .B \echapter
  70. and
  71. .B \esection.
  72. .PP
  73. Code chunks contain program source code and references to other code
  74. chunks.
  75. Several code chunks may have the same name;
  76. .I notangle
  77. concatenates their definitions to produce a single chunk, just as does
  78. .I tangle(1).
  79. Code chunk definitions are like macro definitions;
  80. .I notangle
  81. extracts a program by expanding one chunk (by default, the chunk named
  82. \fB<<\fP*\fB>>\fP).
  83. The definition of that chunk contains references to other chunks, which are 
  84. themselves expanded, and so on.
  85. \fInotangle\fP's output is readable; it preserves the indentation of expanded
  86. chunks with respect to the chunks in which they appear.
  87. .PP
  88. Code may be quoted within documentation
  89. chunks by placing double square brackets
  90. (\fB[[\fI...\fB]]\fR) around it.
  91. These double square brackets are ignored by
  92. .I notangle,
  93. but they may be used by 
  94. .I noweave
  95. to give the code special typographic treatment, e.g., hypertext links.
  96. If quoted code ends with three or more square brackets,
  97. .I noweave
  98. choose the rightmost pair, so that, for example, \fB[[a[i]]]\fR is
  99. parsed correctly.
  100. .PP
  101. If double left and right angle brackets are not paired, they are
  102. treated as literal \fB<<\fP and \fB>>\fP.  Users can force any
  103. such brackets, even paired brackets, to be treated as literal by
  104. using a preceding at sign (e.g. \fB@<<\fP).
  105. .PP
  106. Any line beginning with `\fB@ \fP' terminates a code chunk,
  107. but if the line has the form
  108. .br
  109. \fB@ %def \fP\fIidentifiers\fP
  110. .br
  111. it is taken to mean that the preceding chunk defines the identifiers listed 
  112. in 
  113. .I identifiers.
  114. This list contains identifiers separated by whitespace; 
  115. any sequence of nonwhite characters may be an identifier.
  116. .I noweb
  117. uses a simple heuristic to avoid recognizing identifiers 
  118. that are substrings of other identifiers.
  119. .SH TANGLING
  120. .I notangle
  121. and
  122. .I nountangle
  123. accept the same set of options, although some options have effects only on one 
  124. or the other.
  125. The options are:
  126. .TP
  127. .B -R\fIname\fR
  128. Expand the \fB<<\fIname\fB>>\fR code chunk instead of \fB<<\fP*\fB>>\fP.
  129. .TP
  130. .B -L\fIformat\fR
  131. Emit line number indications at chunk boundaries.
  132. A line number indication identifies the source of the line that follows it.
  133. In
  134. .I format,
  135. .B "%F"
  136. indicates the name of the source file,
  137. .B "%L"
  138. indicates the line number of the source file,
  139. .B "%N"
  140. indicates a newline,
  141. and 
  142. .B "%%"
  143. indicates a percent sign.
  144. A sign and digit may be inserted between the percent sign and the `\fBL\fP',
  145. in which case the line number will be adjusted by that amount.
  146. If 
  147. .I format
  148. is omitted, the default format is that accepted by the C preprocessor:
  149. `\fB#line %L "%F"%N\fR'.
  150. When using the \fB-L\fIformat\fR option, 
  151. .I notangle
  152. ensures that all text appears in the same column in input and output.
  153. .I nountangle
  154. ignores this option.
  155. .TP
  156. .B \-t\fIk\fP
  157. Copy tabs untouched from input to output, and use tabs for indentation, 
  158. assuming stops every \fIk\fP columns.
  159. By default, tabs are expanded to spaces with stops every 8 columns.
  160. .TP
  161. .B \-filter \fIcmd\fP
  162. Filter the 
  163. .I noweb
  164. source through 
  165. .I cmd
  166. after converting it to tool form and before tangling.
  167. .I notangle
  168. looks for 
  169. .I cmd
  170. first on the user's
  171. .B PATH,
  172. then in
  173. .B |LIBDIR|.
  174. Such filters
  175. can be used to add features to
  176. .I notangle;
  177. for an example see
  178. .B |LIBDIR|/emptydefn.
  179. For experts only.
  180. .TP
  181. .B "\-markup \fIparser\fP"
  182. Use 
  183. .I parser
  184. to parse the input file.
  185. Enables use of noweb tools on files in other formats;
  186. for example, the 
  187. .B numarkup
  188. parser understands
  189. .I nuweb(1)
  190. format.
  191. See 
  192. .I nowebfilters(1)
  193. for more information.
  194. For experts only.
  195. .TP
  196. .B "-awk | -c | -icn | -icon | -ml | -m3 | -pascal | -f77 | -f90 | -tex"
  197. When 
  198. .I nountangle
  199. transforms documentation chunks into comments, use the comment format of the language
  200. named.
  201. .B \-c
  202. is the default.
  203. .I notangle
  204. ignores these options.
  205. .TP
  206. .B -w\fIn\fP
  207. When 
  208. .I nountangle
  209. transforms documentation chunks into comments, create comments on lines of width \fIn\fP.
  210. .I notangle
  211. ignores this option.
  212. .SH WEAVING
  213. Output from \fInoweave\fP can
  214. be used in \fITeX\fP documents that 
  215. .B "\\\\input nwmac,"
  216. in \fILaTeX\fP documents that  use the
  217. .B noweb
  218. document-style option (see \fInowebstyle(1)\fP),
  219. and in \fIHTML\fP documents to be browsed with 
  220. .I Mosaic(1).
  221. .I Noweave
  222. treats code chunks somewhat like
  223. .I LaTeX list environments.
  224. If the ``\fB@ \fP'' that terminates a code chunk is followed immediately by text,
  225. that text follows the code chunk without a paragraph break.
  226. If the rest of the line is blank, 
  227. .I noweave
  228. puts 
  229. .I TeX
  230. into ``vertical mode,'' and later text starts a fresh, indented paragraph.
  231. .PP
  232. No page breaks occur in the middle of code chunks unless necessary to avoid
  233. an overfull vbox.
  234. The documentation chunk immediately preceding a code chunk appears on
  235. the same page as that code chunk unless doing so would violate the previous rule.
  236. .PP
  237. .I Noweave
  238. inserts no extra newlines in its \fITeX\fP output, so the line numbers given
  239. in
  240. .I TeX
  241. error messages are the same as those in the input file.
  242. .PP
  243. .I noweave
  244. has
  245. options that dictate choice of 
  246. formatter
  247. and that support different formatting idioms and tools.
  248. Basic options are described here; options related to index
  249. and cross-reference information are described in the 
  250. INDEXING AND CROSS-REFERENCE section.
  251. .TP
  252. .B \-latex
  253. Use LaTeX wrapper in 
  254. .B article
  255. style with
  256. .B noweb
  257. style option and page style. (Default)
  258. .TP 
  259. .B \-tex
  260. Use plain TeX wrapper and the
  261. .B nwmac
  262. macros.
  263. .TP
  264. .B \-html
  265. Format the program for HTML, not TeX or LaTeX. 
  266. If \fB-n\fP is not given, use HTML wrapper as well.
  267. The output is uninteresting without \fB-index\fP or \fB-x\fP.
  268. The tags \fB<nowebchunks>\fP and \fB<nowebindex>\fP, on lines by themselves,
  269. produce a list of chunks and an index of identifiers, respectively.
  270. If these tags are not present, the list and index are placed at the end of the file.
  271. .TP
  272. .B \-latex+html
  273. Assume documentation chunks are LaTeX, but generate HTML for code chunks,
  274. suitably marked so conversion with 
  275. .I latex2html(1)
  276. yields reasonable output.
  277. A LaTeX wrapper is implied, but can be turned off with \fB-n\fP.
  278. .TP
  279. .B \-n
  280. Don't use any wrapper (header or trailer).
  281. This option is useful when \fInoweave\fP's output will be
  282. a part of a larger document.
  283. See also 
  284. .B \-delay.
  285. .TP
  286. .B \-filter \fIcmd\fP
  287. Filters the 
  288. .I noweb
  289. source through 
  290. .I cmd
  291. after converting it to tool form and before converting to
  292. .I TeX.
  293. .I noweave
  294. looks for 
  295. .I cmd
  296. first on the user's
  297. .B PATH,
  298. then in
  299. .B |LIBDIR|.
  300. Such filters
  301. can be used to add features to
  302. .I noweave;
  303. for an example, see
  304. .B |LIBDIR|/noxref.krom.
  305. .I Noweave
  306. supports up to four filters; one can get more by shell trickery, 
  307. for example, \fB-filter "icon.filter | noidx"\fP.
  308. The \fB-autodefs\fP,
  309. \fB-x\fP, \fB-index\fP, and \fB-indexfrom\fP options are implemented as filters.
  310. .TP
  311. .B "\-markup \fIparser\fP"
  312. Use 
  313. .I parser
  314. to parse the input file.
  315. Enables use of noweb tools on files in other formats;
  316. for example, the 
  317. .B numarkup
  318. parser understands
  319. .I nuweb(1)
  320. format.
  321. See 
  322. .I nowebfilters(1)
  323. for more information.
  324. For experts only.
  325. .TP 
  326. .B \-option \fIopt\fP
  327. Adds \fB\enoweboptions{\fP\fIopt\fP\fB}\fP to the
  328. .I LaTeX
  329. header.
  330. Works only with the
  331. .B \-latex
  332. option.
  333. See 
  334. .I nowebstyle(1) 
  335. for values of
  336. .I opt.
  337. .TP
  338. .B \-delay
  339. By default, 
  340. .I noweave
  341. puts file-name and other information into the output before the first chunk
  342. of the program.
  343. .B \-delay
  344. delays that information until after the first documentation chunk, making
  345. act a little bit like the 
  346. .I WEB
  347. ``limbo.''
  348. The option is typically used to enable a user to put a specialized
  349. .I LaTeX
  350. .B "\\\\documentstyle"
  351. command and other preamble material in the first documentation chunk.
  352. This option also forces trailing cross-referencing information to be emitted
  353. just before the final chunk, instead of at the end of the document;
  354. the final chunk is expected to contain
  355. .B "\\\\end{document}."
  356. The 
  357. .B \-delay
  358. option implies the
  359. .B \-n 
  360. option.
  361. .TP
  362. .B \-t\fIk\fP
  363. Expand tabs with stops every \fIk\fP columns.
  364. (Default is to expand every 8 columns.)
  365. .TP
  366. .B \-t
  367. Copy tabs to the output.
  368. .TP
  369. .B \-v
  370. Print the pipeline on standard error.
  371. .SH INDEXING AND CROSS-REFERENCE
  372.  
  373. When used with 
  374. .I LaTeX 
  375. or
  376. .I HTML,
  377. .I noweave
  378. can provide indexing and cross-reference information for chunks and for 
  379. programming-language identifiers.
  380. Identifier definitions may be marked by hand using \fB@ %def\fP, 
  381. or for some languages they may be found automatically using the 
  382. \fB-autodefs\fP option.
  383. This section describes the indexing and cross-reference options;
  384. it might well be skipped on first reading.
  385. .TP
  386. .B \-x
  387. For 
  388. .I LaTeX,
  389. add a page number to each chunk name identifying the location of that
  390. chunk's definition, and emit cross-reference information relating definitions and uses.
  391. For 
  392. .I HTML,
  393. create hypertext links between uses and definitions of chunks.
  394. When
  395. .B noweave -x
  396. is used with
  397. .I LaTeX,
  398. the control sequence
  399. .B "\\\\nowebchunks"
  400. expands to a sorted list of all code chunks.
  401. .TP
  402. .B \-index
  403. Build cross-reference information (or hypertext links) for identifiers defined by
  404. .br
  405. .B "@ %def" 
  406. .I identifiers
  407. .br
  408. Definitions are those found in input files.
  409. Requires
  410. .I LaTeX
  411. or
  412. .I HTML.
  413. .B \-index
  414. implies
  415. .B \-x;
  416. including both will generate strange-looking output.
  417. .I noweave
  418. does not generate
  419. cross-references to identifiers that appear in quoted code (\fB@[[\fP...\fB@]]\fP),
  420. but it does generate hypertext links.
  421. When
  422. .B noweave -index
  423. is used with
  424. .I LaTeX, 
  425. the control sequence
  426. .B "\\\\nowebindex"
  427. expands to an index of identifiers.
  428. .TP
  429. .B \-indexfrom \fIindex\fP
  430. Like 
  431. .B \-index,
  432. but the identifiers to be indexed are taken from file \fIindex\fP.
  433. See
  434. .I noindex(1).
  435. .TP
  436. .B \-autodefs \fIlang\fP
  437. Discover identifier definitions automatically.
  438. Code in chunks must be in language \fIlang\fP.
  439. Permissible \fIlang\fPs vary but may include
  440. .B tex
  441. or 
  442. .B icon.
  443. Useless without
  444. .B \-index,
  445. which it must precede.
  446. .TP
  447. .B \-showautodefs
  448. Show values of \fIlang\fP usable with \fB-autodefs\fP.
  449. .SH ERROR MESSAGES
  450. If
  451. .I notangle
  452. or
  453. .I noweave
  454. encounters a chunk name within documentation, it assumes that this
  455. indicates an error, usually misspelling ``<<name>>=''.
  456. Other error messages should be self-explanatory.
  457. .PP
  458. It is incorrect to refer to a chunk that is never
  459. defined, but it is OK for chunks to be defined and not used.
  460. .SH FILES
  461. .PP
  462. .ta \w'|TEXINPUTS|nwkernel.texxxxx'u
  463. .nf
  464. |LIBDIR|/markup    markup preprocessor
  465. |LIBDIR|/unmarkup    inverts markup
  466. |LIBDIR|/nt    notangle proper
  467. |LIBDIR|/finduses    find uses of identifiers for index
  468. |LIBDIR|/noidx    generate index and cross-reference info
  469. |LIBDIR|/totex    back end to emit \fITeX\fP or \fILaTeX\fP
  470. |LIBDIR|/tohtml    back end to emit HTML
  471. |TEXINPUTS|/nwmac.tex    formatting \fITeX\fP macros
  472. |TEXINPUTS|/noweb.sty    use in \fILaTeX\fP documents; see \fInowebstyle(1)\fP
  473. .fi
  474. .SH SEE ALSO
  475. .PP
  476. .I cpif(1), nodefs(1), noroots(1), noweb(1), noindex(1), nowebstyle(1), nowebfilters(1)
  477. .SH BUGS
  478. .I notangle 
  479. and
  480. .I nountangle
  481. fail if names used on the command line contain single quotes.
  482. .PP
  483. Ignoring unused chunks can cause problems;
  484. if a chunk has
  485. multiple definitions and one is misspelled,
  486. the misspelled definition is silently ignored.
  487. .I noroots(1)
  488. can be used to catch this mistake.
  489. .PP
  490. .I noweb
  491. requires the new version of
  492. .I awk,
  493. assumed to be called
  494. .I nawk.
  495. DEC
  496. .I nawk
  497. has a bug in that that causes 
  498. .B noweave
  499. to fail to translate braces correctly.
  500. GNU 
  501. .I gawk
  502. is reported to work.
  503. .PP
  504. DEC 
  505. .I sh
  506. has a bug that causes the
  507. .B \-filter
  508. option to fail whenever the filter command contains more than one word.
  509. .PP
  510. The default
  511. .I LaTeX
  512. pagestyles don't set the width of the boxes containing headers and footers.
  513. Since 
  514. .I noweb
  515. code paragraphs are extra wide, this 
  516. .I LaTeX
  517. bug sometimes results in extra-wide headers and footers.
  518. The remedy is to redefine the relevant 
  519. .B ps@*
  520. commands;
  521. .B ps@noweb
  522. in 
  523. .B noweb.sty
  524. can be used as an example.
  525. .PP
  526. .I latex2html(1)
  527. mangles some source files.
  528. .PP
  529. .I noweave
  530. has too many options, and this man page is too long.
  531. .SH AUTHOR
  532. Norman Ramsey, Bellcore.
  533. Internet address \fBnorman@bellcore.com\fP.
  534. .br
  535. Noweb home page at \fBftp://bellcore.com/pub/norman/www/noweb/intro.html\fP.
  536.